The present disclosure generally relates to object-oriented programming, and more specifically to accessing resources of object-oriented programs.
Programs developed by object-oriented languages such as C++, Visual C#®.NET (Microsoft Inc.) or Java™ (Oracle Inc.) may have, and generally have, resources such as variables, objects or functions which are protected from accessing by other resources.
Thus, a test code for accessing resources of a program during execution is denied access to private or protected resources, thereby decreasing a functionality and objective of the test code.
Methods were developed to enable access to private or protected resources, such as in the following publications.
U.S. Pat. No. 6,986,144 reports accessing by an instance of a first class to a selected protected resource of an instance of a second class by defining a third class that includes a protected virtual method for accessing the selected protected resource.
US Application 2008/0022260 reports accessing by an extension identifying an internal state that may be exposed via accessor methods.
U.S. Pat. No. 5,794,044 reports a modified interpreter that uses special “privileged” load and store instructions that access private variables and constants outside the method being executed.
U.S. Pat. No. 7,668,862 reports a method based on associating an access-token with a caller object which is to be allowed to access a restricted method and sharing this access-token with the resource object.
U.S. Pat. No. 5,784,620 reports a system that includes a base class and a related derived class and a state selector class that provides state selection to the base class where each operational object includes an internal object having a pair of internal states.